home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / CBGRX103.ZIP / contrib / libgrx / src / biosfont.c < prev    next >
Text File  |  1993-12-06  |  3KB  |  95 lines

  1. /**
  2.  ** BIOSFONT.C
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #include "grx.h"
  25. #include "libgrx.h"
  26. #include "grxfont.h"
  27. #include "grxfile.h"
  28. #include "interrup.h"
  29.  
  30. #include <string.h>
  31.  
  32. static FixedFont bios8x8font  = { { 0 }, 0 };
  33. static FixedFont bios8x14font = { { 0 }, 0 };
  34. static FixedFont bios8x16font = { { 0 }, 0 };
  35.  
  36. GrFont *GrLoadBIOSFont(char *name)
  37. {
  38.     FixedFont *result;
  39.     REGISTERS reg;
  40.     int height,baseline;
  41.  
  42.     switch(_GrAdapterType) {
  43.       case GR_VGA:
  44.       case GR_8514A:
  45.       case GR_S3:
  46.         if(strcmp(name,"@:pc8x16"FNTEXT) == 0) {
  47.         result     = &bios8x16font;
  48.         height     = 16;
  49.         baseline = 11;
  50.         reg.r_bx = 0x0600;
  51.         break;
  52.         }
  53.       case GR_EGA:
  54.         if(strcmp(name,"@:pc8x14"FNTEXT) == 0) {
  55.         result     = &bios8x14font;
  56.         height     = 14;
  57.         baseline = 10;
  58.         reg.r_bx = 0x0200;
  59.         break;
  60.         }
  61.         if(strcmp(name,"@:pc8x8"FNTEXT) == 0) {
  62.         result     = &bios8x8font;
  63.         height     = 8;
  64.         baseline = 6;
  65.         reg.r_bx = 0x0300;
  66.         break;
  67.         }
  68.       default:
  69.         return(NULL);
  70.     }
  71.     if(result->ff_bits == (char far *)NULL) {
  72.         reg.r_ax = 0x1130;
  73.         int10(®);
  74.         result->h.fnt_isfixed  = TRUE;
  75.         result->h.fnt_width       = 8;
  76.         result->h.fnt_height   = height;
  77.         result->h.fnt_minchar  = 0;
  78.         result->h.fnt_maxchar  = 255;
  79.         result->h.fnt_internal = TRUE;
  80.         result->h.fnt_baseline = baseline;
  81.         result->h.fnt_undwidth = 1;
  82.         strcpy(result->h.fnt_name,name);
  83.         strcpy(result->h.fnt_family,"pc");
  84.         result->ff_chrsize = height;
  85. #ifdef __GNUC__
  86.         result->ff_bits = (char *)reg.r_bp;
  87. #endif
  88. #ifdef __TURBOC__
  89.         result->ff_bits = MK_FP(reg.r_es,reg.r_bp);
  90. #endif
  91.     }
  92.     return((GrFont *)result);
  93. }
  94.  
  95.